package com.jsh.erp.controller;

import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.WorkflowConfigDetailVo4Body;
import com.jsh.erp.service.WorkflowConfig.WorkflowConfigService;
import com.jsh.erp.service.redis.RedisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping(value = "/workflowConfig", produces = "application/json;charset=UTF-8")
@Api(tags = {"分配人员"})
public class WorkflowConfigController {


    @Resource
    private WorkflowConfigService workflowConfigService;
    @Resource
    private RedisService redisService;

    @RequestMapping(value = "/doSaveConfigUser", method = {RequestMethod.PUT})
    @ResponseBody
    @ApiOperation(value = "保存人员设置", notes = "保存人员设置")
    public Object doSaveConfigUser(@RequestBody WorkflowConfigDetailVo4Body body, HttpServletRequest request) throws Exception {
        String lanCode = redisService.getLanCodeFromSession(request);
        JSONObject result = ExceptionConstants.standardSuccess(lanCode);
        workflowConfigService.saveConfigUser(body,request);
        return result;
    }

}
